define([
  'views/List',
  'views/internals/UserItem',
  'views/internals/UserModal',
  'hbs!template/internals/users-list'
  
], function(List, UserItem, UserModal, template){
  var UsersList = List.extend({
    itemView: UserItem,
    listEvents: {
      "click button[name=add]":		"add"
    },

    initList: function(options) {
      this.template = template;
      this.collection.bind("change", this.render, this);
    },
    
    add: function() {
      var modal = new UserModal({
        model: new this.collection.model(),
        collection: this.collection
      });
      modal.render();
    }
  });

  return UsersList;
});